/*
 * @Description: 
 * @version: 
 * @Author: 171
 * @Date: 2022-08-31 10:29:55
 * @LastEditors: 171
 * @LastEditTime: 2022-09-15 18:04:06
 */
import { createRouter, createWebHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/home',
    name: 'home', // 名称不要重复
    component: () => import('../views/Home.vue') // 这种形式会在打包时对文件进行分割，代码优化
  },{
    path: '/',
    redirect: '/home'
  },{
    path: '/login',
    name: 'login',
    component: () => import('../views/Login.vue')
  },{
    path: '/my',
    name: 'my', 
    component: () => import('../views/My.vue') 
  },{
    path: '/talk',
    name: 'talk', 
    children: [
      {
        path: '',
        name: 'talk-list', 
        component: () => import('../views/Talk/List.vue'),
      },{
        path: 'editor',
        name: 'talk-editor', 
        component: () => import('../views/Talk/Editor.vue'),
      },{
        path: 'detail',
        name: 'talk-detail', 
        component: () => import('../views/Talk/Detail.vue'),
      }
    ]
  },{
    path: '/epidemic',
    name: 'epidemic', 
    component: () => import('../views/Epidemic.vue'),
  },{
    path: '/interact',
    name: 'interact', 
    component: () => import('../views/Interact.vue'),
  }
] 
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

export default router
